home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 1997 #1
/
Amiga Plus CD - 1997 - No. 01.iso
/
pd
/
programmierung
/
arexxport_dev
/
docs
/
arexxport.doc
next >
Wrap
Text File
|
1996-05-06
|
14KB
|
531 lines
TABLE OF CONTENTS
arexxport.library/--RexxHost--
arexxport.library/ArexxMacroAbort
arexxport.library/ArexxMacroPending
arexxport.library/CheckArexxPort
ArexxPort.library/CloseArexxPort
arexxport.library/LaunchArexx
arexxport.library/OpenArexxPort
Arexxport.library/PutToArexxPort
arexxport.library/ReplyArexxPort
arexxport.library/ReturnArexxError
arexxport.library/SetArexxError
Arexxport.library/SetArexxReturns
arexxport.library/SetArexxReturnVar
arexxport.library/SetArexxStem
arexxport.library/--RexxHost-- arexxport.library/--RexxHost--
There is a single rexxhost function in this library.
The function is LocalErrorText() and it is a localised
version of the Arexx internal function ErrorText().
The arexx entry point to the library is at -108.
This function appeared in v37 of the library.
EXAMPLE
if ~show("L","arexxport.library") then
if ~addlib("arexxport.library", 37, -108) then exit
say localerrortext( 19 )
NOTES
Created : 06/05/96
BUGS
SEE ALSO
arexxport.library/ArexxMacroAbort arexxport.library/ArexxMacroAbort
NAME
ArexxMacroAbort -- Set the abort flag for a port.
SYNOPSIS
ArexxMacroAbort( port, all )
a0 d0
void ArexxMacroAbort( struct ArexxPort, BOOL )
FUNCTION
Sets the abort flag for the given port and ports chained to it if
the 'all' flag is true. The abort flag is only set if a port
currently has any macro's pending. The abort flag is cleared
when the last macro returns.
INPUTS
port - Port to set abort flag for.
all - If true, set abort flag for all chained ports.
RESULT
None.
EXAMPLE
NOTES
Created : 17/06/95
BUGS
SEE ALSO
arexxport.library/ArexxMacroPending arexxport.library/ArexxMacroPending
NAME
ArexxMacroPending -- Checks if macros are pending from this port.
SYNOPSIS
res = ArexxMacroPending( port )
a0
BOOL ArexxMacroPending( struct ArexxPort * )
FUNCTION
Checks if any macros have been launched from this port (or any chained)
to it and not yet returned.
INPUTS
port - Port to check.
RESULT
res - TRUE if macros are pending. FALSE otherwise.
EXAMPLE
NOTES
Created : 20/03/96
BUGS
SEE ALSO
arexxport.library/CheckArexxPort arexxport.library/CheckArexxPort
NAME
CheckArexxPort -- Called to check if messages have arrived.
SYNOPSIS
Arexxmsg = CheckArexxPort( port )
a0
struct ArexxMsg * CheckArexxPort( struct ArexxPort )
FUNCTION
Checks the given port (and those chained to it) for messages that
have arrived. Fills in a struct ArexxMsg with the details and returns
it. This function doesn't reply to the RexxMsg so a call to
ReplyArexxPort() is required after processing the ArexxMsg.
INPUTS
port - The port to check.
RESULT
ArexxMsg - a filled in arexxmsg structure.
EXAMPLE
NOTES
Created : 02/05/95
BUGFIX : 06/10/95 Now checks all chained ports, regardless of
the starting ports placement in the chain.
BUGS
SEE ALSO
ArexxPort.library/CloseArexxPort ArexxPort.library/CloseArexxPort
NAME
CloseArexxPort -- Close an arexx port.
SYNOPSIS
CloseArexxPort( port )
a0
void CloseArexxPort( struct ArexxPort *)
FUNCTION
Closes an arexx port opened with OpenArexxPort(). Will Guru if there
are any outstanding macros lauched from this port. Check before
closing. Using the MACROPENDING( port ) macro.
INPUTS
port - Pointer to the port to close.
RESULT
None
EXAMPLE
NOTES
Created : 02/05/95
BUGS
SEE ALSO
arexxport.library/LaunchArexx arexxport.library/LaunchArexx
NAME
LaunchArexx -- Launches a arexx script.
SYNOPSIS
invoc = *LaunchArexx( port, macro, console, user )
a0 a1 d0 d1
struct ArexxInvocation *LaunchArexx( struct ArexxPort *, STRPTR,
BOOL, ULONG )
FUNCTION
Launches an arexx script from the given port. The script will return
an AREXX_MESSAGE a some point. The port must not be closed until the
script returns. Args for the script can be passed by joining them
onto the macros name.
INPUTS
port - Pointer to the port to use as a default host.
macro - The name of the macro, ie "test.rexx".
console - If true then a console will be opened for the scripts output.
user - Data which is copied into the User_Data field of the
ArexxInvocation struct.
RESULT
invoc - Pointer to an ArexxInvocation struct. NULL if this failed.
EXAMPLE
NOTES
Created : 15/10/95
BUGS
SEE ALSO
arexxport.library/OpenArexxPort arexxport.library/OpenArexxPort
NAME
OpenArexxPort -- Open a new arexx port for an application
SYNOPSIS
Port = OpenArexxPort( portname, tags )
a0 a1
struct ArexxPort *OpenArexxPort( STRPTR, struct TagItem )
FUNCTION
Opens a new arexx port for an application.
INPUTS
portname - Basename of the port. This is copied, so doesn't have to
remain valid.
tags - The tags available are
ARLT_NOINSTANCE (BOOL) - Just use the basename as the port name
don't put any (.##) number on the basename. (Default FALSE)
OpenPort will fail if this is given and a named port already
exists.
ARLT_COMMANDS - Pointer to command table list. Default NULL or if
command table from chained port. A pointer to this is stored
so it must remain valid. Default to none or the chained port.
ARLT_CONSOLE - Pointer to console def string. Default NULL or
console from chained port. Only a pointer is stored.
ARLT_CHAIN - Pointer to another ArexxLib port to chain this one
onto the end of. (Default NULL).
ARLT_EXTENSION - Pointer to a string containing the extension for
the default macros. Default none or the chained port's value.
Only a pointer is stored.
ARLT_USER (ULONG) - User data.
ARLT_LASTERROR - Determines what should be done with error messages.
These errors are either generated internally by the command line
parsing or can be set by your program using the SetArexxError()
command. If this tags isn't given then the text of the error
message is written into the 'EXTERNERROR' variable in the arexx
script. If this tag is passed a pointer to a string then this
string will be used as the variable name instead of 'EXTERNERROR'.
ie ARLT_LASTERROR, "MULTIVIEW.LASTERROR". Only a pointer to this
string is stored and the string must be in uppercase.
If a NULL is pased then the text of the last error will in stored
and pointed to by the port->LastError. This allows the creation
of a 'lasterror' command for the port. The ports behaviour will
be the same as any chained port. (v37)
RESULT
port - Pointer to the port or null if it failed.
EXAMPLE
NOTES
Created : 30/04/95
Bug fix in the chainport linking. 17 Aug 1995
BUGS
SEE ALSO
Arexxport.library/PutToArexxPort Arexxport.library/PutToArexxPort
>>>>>>>>>>>>>> Doesn't work yet <<<<<<<<<<<<<<<<<<<<<
NAME
PutToArexxPort -- Puts a string to a named port.
SYNOPSIS
Success = PutToArexxPort( port, msg )
a0 d1
BOOL PutToArexxPort( STRPTR, STRPTR )
FUNCTION
INPUTS
port - The name of the public arexx port.
msg - The string of text to be sent.
RESULT
Success - True is suceeds. False for a failure.
EXAMPLE
NOTES
Created : 17/06/95
BUGS
SEE ALSO
arexxport.library/ReplyArexxPort arexxport.library/ReplyArexxPort
NAME
ReplyArexxPort -- Deallocates an ArexxMsg struct.
SYNOPSIS
ReplyArexxPort( amsg )
a0
void ReplyArexxPort( struct ArexxMsg )
FUNCTION
Deallocates an ArexxMsg structure and replies to the RexxMsg message
as required. This is a call that should match CheckArexxPort.
INPUTS
amsg - The ArexxMsg struct to clear.
RESULT
None.
EXAMPLE
NOTES
Created : 16/06/95
BUGS
SEE ALSO
arexxport.library/ReturnArexxError arexxport.library/ReturnArexxError
NAME
ReturnArexxError -- Returns the ports last error message. (v37)
SYNOPSIS
result = ReturnArexxError( amsg )
a0
UWORD ReturnArexxError( struct ArexxMsg * )
FUNCTION
This returns the last error message of the port to the
rexx script. It will return the value in the RESULT field
of the message. Unless arg[0] of the ArexxMsg is set in which
case that string will be used as a a variable name. This is the
command to call if you wish to implement a LastError or Fault
command - in combination with the ARLV_LASTERROR = NULL.
INPUTS
amsg - The message.
RESULT
Returns 0 for success.
Non zero for failure.
EXAMPLE
struct ArexxFunction mainctab[] = {
...
{"lasterror", &ReturnArexxError, "VAR" },
The user call this command to find why the last command
failed. The text of the error will be returned in RESULT
or in VAR if the user suppiles one.
{NULL,NULL,NULL},
};
...
while( amsg = CheckArexxPort( MainRexxPort) ) {
if(amsg->Type == AREXX_COMMAND) {
void (*target)( struct ArexxMsg *msg );
target = (void *)amsg->User_Data;
target( amsg );
}
ReplyArexxPort( amsg );
}
NOTES
Created : 07/04/96
BUGS
SEE ALSO
arexxport.library/SetArexxError arexxport.library/SetArexxError
NAME
SetArexxError -- Return an error to the arexx script.
SYNOPSIS
SetArexxError( Amsg, error, level )
a0 a1 d0
void SetArexxError( struct ArexxMsg, STRPTR, UWORD )
FUNCTION
Sets the RC of a command. The passed error message is either
stored in port->LastError, written into the rexx variable or
into 'EXTERNERROR' (see OpenArexxPort - ARLT_LASTERROR for
details.)
INPUTS
Amsg - Command to fail.
error - The text of the error message.
level - The level of the RC for the error.
RESULT
None.
EXAMPLE
NOTES
Created : 16/06/95
BUGS
SEE ALSO
Arexxport.library/SetArexxReturns Arexxport.library/SetArexxReturns
NAME
SetArexxReturns -- Set the return values.
SYNOPSIS
SetArexxReturns( msg, rc, r2 )
a0 d0 a1
void SetArexxReturns( struct ArexxMsg *, UWORD, APTR )
FUNCTION
Sets the value of the return codes for the given Arexxmsg.
If rc is not 0 then Arexx will not set the RESULT variable.
This is not a bug but a feature of Arexx.
INPUTS
msg - ArexxMsg to set return codes for.
rc - Value of return code 1. (RC a number.)
r2 - String to put in result string. requires Options Results to be
set.
RESULT
None.
EXAMPLE
NOTES
Created : 16/06/95
BUGS
SEE ALSO
arexxport.library/SetArexxReturnVar arexxport.library/SetArexxReturnVar
NAME
SetRexxReturnVar -- Sets the return values. (v37)
SYNOPSIS
result = SetArexxReturnVar( amsg, rc, r2, var )
a0 d0 a1 a2
UWORD SetArexxReturnVar( struct ArexxMsg *, UWORD, STRPTR, STRPTR )
FUNCTION
Sets the RC and RESULT values of a message, like SetArexxReturn()
however if var is non NULL the r2 value will be written into the
the variable named. This is to make it easy to implement the 'VAR'
command option for returning values.
INPUTS
amsg - Arexx msg to set values into.
rc - Primary Return code.
r2 - Secondary string.
var - Variable to write r2 into or NULL.
RESULT
Non NULL for a failure, zero for sucess.
EXAMPLE
NOTES
Created : 08/04/96
BUGS
SEE ALSO
arexxport.library/SetArexxStem arexxport.library/SetArexxStem
NAME
SetArexxStem -- Set a stem variable in arexx.
SYNOPSIS
error = SetArexxStem( stem, exten, setto, msg )
a0 a1 a2 a3
LONG SetArexxStem( STRPTR, STRPTR, STRPTR, struct RexxMsg )
FUNCTION
This function will sttempt to set the value of the symbol
stem.exten in the Arexx script that sent the message.
INPUTS
stem - Stem part of the variable.
exten - The extention part of the variable.
setto - A string that will be the new value of the variable.
msg - The RexxMsg that variable refers to.
RESULT
error 0 for sucess, otherwise an error vode.
(Other codes may exist these are documented).
3 == Insufficient Storage.
9 == String too Long.
10 == Invalid message.
EXAMPLE
if( SetArexxStem( "fish","count","120", msg ) != 0 ) {
/* An error has occured */
} else {
/* Variable 'fish.count' = 120 */
}
NOTES
Created : 16/06/95
Removed limitations and added return code for v37 : 12/4/96
v36 libraries don't set the return code.
BUGS
SEE ALSO
amiga.lib/SetRexxVar()